import request from '../utils/request';

/**
 * 商品列表
 * goods_id, page, page_number
 */
export function goodsList(data) {
  return request({
    url: 'goods/lists',
    method: 'get',
    data: data
  });
}

//加入购物车
export function addShoppingCart(data) {
  return request({
    url: 'shopping-cart/add',
    method: 'post',
    data
  });
}
//购物车列表
export function ShoppingCartlist(data) {
  return request({
    url: 'shopping-cart/lists',
    method: 'get',
    data
  });
}
//删除购物车
export function ShoppingCartdel(data) {
  return request({
    url: 'shopping-cart/delete',
    method: 'delete',
    data
  });
}
//购物车编辑
export function ShoppingCartEdit(data) {
  return request({
    url: 'shopping-cart/edit-batch',
    method: 'put',
    data
  });
}
//购物车->订单结算页
export function ShoppingCartpurchase(data) {
  return request({
    url: 'shopping-cart/purchase',
    method: 'post',
    data
  });
}
//直接购买
export function goodsPurchase(data) {
  return request({
    url: '/goods/purchase',
    method: 'post',
    data
  });
}
/**
 * 商品详情
 * goods_id
 */
export function goodsDetail(data) {
  return request({
    url: 'goods/detail',
    method: 'get',
    data: data
  });
}
//优惠券详情
export function couponDetail(data) {
  return request({
    url: 'goods/sku-detail',
    method: 'get',
    data: data
  });
}
/**
 * 商品详情
 * goods_id
 */
export function goodsHotDetail(data) {
  return request({
    url: 'hot-goods/detail',
    method: 'get',
    data: data
  });
}



/**
 * 购买商品
 * sku_id, num
 */
export function purchaseGood(data) {
  return request({
    url: 'goods/purchase',
    method: 'post',
    data: data
  });
}


/**
 * 购买热卖商品
 * sku_id, num
 */
export function purchaseHotGood(data) {
  return request({
    url: 'hot-goods/purchase',
    method: 'post',
    data: data
  });
}

/**
 * 购买商品使用优惠券
 * sku_id, num
 */
export function purchaseGoodUseCoupon(data) {
  return request({
    url: 'goods/coupon/purchase',
    method: 'post',
    data: data
  });
}


/**
 * 兑换商品详情
 * exchange_no
 */
export function exchangeGoodsDetail(data) {
  return request({
    url: 'goods/exchange-detail',
    method: 'post',
    data: data
  });
}



/**
 * 商品列表
 * exchange_no
 */
export function getCouponGoodList(data) {
  return request({
    url: 'coupon/goods/list',
    method: 'get',
    data: data
  });
}
